home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15232 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.8 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.tcl,comp.unix.programmer,comp.unix.questions,comp.unix.shell,comp.lang.awk,comp.lang.c,comp.lang.perl.misc,comp.programming,comp.software-eng
  4. Subject: Re: Appropriate Tools and Approach for Kill Application
  5. Date: 17 Apr 1996 13:18:15 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4l3jm7INNi43@keats.ugrad.cs.ubc.ca>
  8. References: <Pine.SOL.3.91.960417003525.18392A-100000@sun22>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <Pine.SOL.3.91.960417003525.18392A-100000@sun22>,
  12.  <mjw@pobox.com> wrote:
  13.  >I am interested in writing a fancy program to kill processes and could use
  14.  >some advice on appropriate tools, languages, and approaches. 
  15.  >
  16.  >I would like the program to function as follows:
  17.  >
  18.  >There will exist a command line switch to correspond to each process
  19.  >characterstic. A process characteristic will most likely be each of the
  20.  >fields displayed in a full process list (ps -ef on many systems.) Using
  21.  >these switches, a user will be able to specify one or more characteristics
  22.  >with the ability to use regular expressions.  Also, where appropriate, he
  23.  >or she may include processes to be killed by using equalities/
  24.  >inequalities. 
  25.  >
  26.  >
  27.  >i.e.
  28.  >
  29.  >kill -n x*
  30.  >
  31.  >would kill xterm, xrn, xmosaic, etc.
  32.  >
  33.  >
  34.  >kill -n x* -t >=5h2m
  35.  >
  36.  >would kill all processes beginning with lowercase x and which have been
  37.  >running at least than five hours and two minutes. 
  38.  
  39. Basically, the ``killall'' command that distributes with Slackware linux has
  40. some functionality along this vein. If you type ``kilall xterm'', it will kill
  41. all xterms.
  42.  
  43.  >Can you please help with the following questions:
  44.  >
  45.  >1) What tools or languages would be best to use?  C, Tcl, scripting langs,
  46.  >LEX & YACC, etc. 
  47.  
  48. I'd write an awk script which processes the output of ps, but I'd try to patch
  49. it together using POSIX.2 shell scripting first, in conjunction with grep and
  50. friends. As a last resort, I'd resort to things that are not POSIX.2
  51. standardized, like perl, etc.
  52.  
  53.  >2) What are some good strategies and their pros and cons for implementing
  54.  >this functionality in different software forms i.e. script, program, 
  55.  >combination, etc.
  56.  
  57. A script is likely to be easier to port than a C program.
  58.  
  59.  >3) Are there any guidelines or tips for designing the syntax to jive with
  60.  >standard practice? 
  61.  
  62. Hell no! Does comp.macintosh.programmer appear in any of the newsgroups you
  63. spammed? :)
  64.  
  65. Don't even DARE to be consistent with any other command, you blasphemer! :))
  66.  
  67.  
  68. Seriously, the ``find'' syntax might be cool.
  69.  
  70.     findjob -name "x*" -user bob -exec kill -STOP {} \;
  71.  
  72. Find is the most user-friendly program there ever was, so that's the one to
  73. emulate.
  74. -- 
  75. I'm not really a jerk, but I play one on Usenet.
  76.